package com.supermap.geometrist.toolkit.extend;

import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.supermap.geometrist.toolkit.extend.api.GeometristProviderApi;
import com.supermap.services.components.Component;
import com.supermap.services.components.ComponentContext;
import com.supermap.services.components.ComponentContextAware;

@Component(providerTypes = {GeometristProviderApi.class}, type = "", optional = false)
public class GeometristComponent implements ComponentContextAware {

    private GeometristProviderApi geometristProviderApi = null;

    @Override
    public void setComponentContext(ComponentContext context) {
        // TODO Auto-generated method stub
        List<GeometristProviderApi> mapproviders = context.getProviders(GeometristProviderApi.class);
        if (!mapproviders.isEmpty()) {
            this.geometristProviderApi = mapproviders.get(0);
        }
    }


    public String geometristMethod(JSONObject paramJSON) {
        return geometristProviderApi.geometristMethod(paramJSON);
    }
}

